package com.hfzy.ihk.web.callhistoryold.enumType;

import java.util.HashMap;
import java.util.Map;

//呼叫类型
public enum CallChannel {
    FORM_PC("PC", "PC端"),
    FORM_PHONE("CellPhone", "手机端");

    private String value;
    private String desc;

    static Map<String, CallChannel> valueMap = new HashMap<String, CallChannel>();
    static Map<String, CallChannel> descMap = new HashMap<String, CallChannel>();

	
	CallChannel(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String toStr() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    static {
        for(CallChannel value : CallChannel.values()) {
            valueMap.put(value.toStr(), value);
            descMap.put(value.desc, value);
        }
    }

    static CallChannel fromStr(String value) {
        CallChannel ret = valueMap.get(value);
        if(ret != null)
            return ret;
        else
            throw new IllegalArgumentException("No enum const " + CallChannel.class + "." + value);
    }

    static CallChannel fromDesc(String desc) {
        CallChannel ret = descMap.get(desc);
        if(ret != null)
            return ret;
        else
            throw new IllegalArgumentException("No enum const " + CallChannel.class + "." + desc);
    }
}